﻿package com.adsame.core
{
	import flash.utils.Dictionary;

	import com.adsame.interfaces.*;
	import com.adsame.exceptions.*;

	public final class AsamParams implements IAsamParams
	{
		/* ==================== 成员变量定义开始 ==================== */

		private var __params : Dictionary = new Dictionary();

		private var __ad_type : String = "";
		/* ==================== 成员变量定义结束 ==================== */


		/* ==================== 成员方法定义开始 ==================== */
		public function AsamParams(data : Object) : void
		{
			if (!data["ad_type"] || typeof(data["ad_type"]) != "string")
				throw new AsamSysCodeException("100003");

			this.__ad_type = data["ad_type"];

			for (var key in data)
			{
				if (key == "ad_type" || typeof(data[key]) != "string")
				{
					continue;
				}
				else
				{
					this.__params["_" + this.__ad_type + "_" + key] = data[key];
				}
			}
		}

		public function getAdtype() : String
		{
			return this.__ad_type;
		}

		public function getParamValue(name : String) : String
		{
			if (this.__params[name])
				return this.__params[name];
			else
				return null;
		}
		/* ==================== 成员方法定义结束 ==================== */
	}
}
